package com.example.memo2.data.repository

import androidx.lifecycle.LiveData
import com.example.memo2.data.database.MemoDao
import com.example.memo2.data.model.Memo
import java.util.Date

class MemoRepository(private val memoDao: MemoDao) {
    
    fun getAllMemos(): LiveData<List<Memo>> = memoDao.getAllMemos()
    
    suspend fun getMemoById(id: Long): Memo? = memoDao.getMemoById(id)
    
    fun getMemosByDate(date: Date): LiveData<List<Memo>> = memoDao.getMemosByDate(date.time)
    
    suspend fun getMemosWithReminders(): List<Memo> = memoDao.getMemosWithReminders(System.currentTimeMillis())
    
    suspend fun insertMemo(memo: Memo): Long = memoDao.insertMemo(memo)
    
    suspend fun updateMemo(memo: Memo) = memoDao.updateMemo(memo)
    
    suspend fun deleteMemo(memo: Memo) = memoDao.deleteMemo(memo)
    
    suspend fun deleteMemosByIds(ids: List<Long>) = memoDao.deleteMemosByIds(ids)
    
    fun searchMemos(query: String): LiveData<List<Memo>> = memoDao.searchMemos(query)
} 